package org.lansir.af.database;

/**
 * 
 * @author 蓝智宏
 *
 */
public class DataRowAlarm extends DataRow{

	//各个字段的索引
	public static class fid {
		public static final int ID = 0;
		public static final int ActivityID= 1;
		public static final int Snooze = 2;
		public static final int SnoozeCount = 3;
		public static final int ActionClear = 4;
	};
	
	// Table definition
	private final DataField[] TableDef = {
			new DataField(fid.ID, "_ID", DataField.Type.INT, true, true),
			new DataField(fid.ActivityID, "ActivityID", DataField.Type.INT, true,
					false),
			new DataField(fid.Snooze, "Snooze", DataField.Type.INT, true,
							false),
			new DataField(fid.SnoozeCount, "SnoozeCount", DataField.Type.INT, true, false),
			new DataField(fid.ActionClear, "ActionClear", DataField.Type.INT,
					true, false)
		};
	private long lAlarmID;
	private long lActivityID;
	private int iSnooze;
	private int iSnoozeCount;
	public long lActionClear = 0;
	
	public DataRowAlarm(Database userdb) {
		super(userdb);
		setTableDefinition(TableDef);
	}

	@Override
	public boolean validate() {
		return true;
	}



	@Override
	public String getTableName() {
		return Database.sTableNameAlarms;	
	}

	@Override
	public void getValuesFromDataRow() {
		
		setAlarmID(value(fid.ID).asLong());
		setActivityID(value(fid.ActivityID).asLong());
		setSnooze(value(fid.Snooze).asInt());
		setSnoozeCount(value(fid.SnoozeCount).asInt());
		setActionClear(value(fid.ActionClear).asLong());
	}

	@Override
	public void setValuesForDataRow() {
		clearContentValues();
		value(fid.ActivityID).set(this.lActivityID);
		value(fid.Snooze).set(this.iSnooze);
		value(fid.SnoozeCount).set(this.iSnoozeCount);
		value(fid.ActionClear).set(lActionClear);
	}
	

	public long getActivityID() {
		return lActivityID;
	}

	public void setActivityID(long activityID) {
		lActivityID = activityID;
	}

	public int getSnooze() {
		return iSnooze;
	}

	public void setSnooze(int snooze) {
		iSnooze = snooze;
	}

	public int getSnoozeCount() {
		return iSnoozeCount;
	}

	public void setSnoozeCount(int snoozeCount) {
		iSnoozeCount = snoozeCount;
	}

	public long getAlarmID() {
		return lAlarmID;
	}

	public void setAlarmID(long alarmID) {
		lAlarmID = alarmID;
	}

	public long getActionClear() {
		return lActionClear;
	}

	public void setActionClear(long actionClear) {
		lActionClear = actionClear;
	}
	
	
}
